package org.footballmanager.pandafootball.system.form.impl;

import lombok.Getter;
import lombok.Setter;
import org.footballmanager.pandafootball.system.domain.FootGp;
import org.footballmanager.pandafootball.system.form.SearchForm;
import tk.mybatis.mapper.entity.Example;

import java.io.Serializable;
import java.util.Date;

@Getter
@Setter
public class FootGpSearchForm extends SearchForm implements Serializable {
	private static final long serialVersionUID = 8090668615941861530L;
	protected String qyName;
	protected Date gpsj;
	protected Long buyUserId;
	protected Boolean cj;
	protected Long sellUserId;

	public Example buildSearchCommond() {
		Example example = new Example(FootGp.class);
		Example.Criteria criteria = example.createCriteria();
		if (gpsj != null) {
            criteria.andEqualTo("gpsj", gpsj);
		}
		if(cj != null){
			criteria.andEqualTo("cj", cj);
		}
		if(sellUserId != null){
			criteria.andEqualTo("sellUserId", sellUserId);
		}
        if(buyUserId != null){
            criteria.andEqualTo("buyUserId", buyUserId);
        }
        criteria.andEqualTo("delFlag", 0);
        example.orderBy("gpsj desc");
		return example;
	}

}
